'\" te
.\"  Copyright (c) 2003 Sun Microsystems, Inc. - All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ALIASES 5 "Feb 25, 2017"
.SH NAME
aliases, addresses, forward \- addresses and aliases for sendmail
.SH SYNOPSIS
.LP
.nf
/etc/mail/aliases
.fi

.LP
.nf
/etc/mail/aliases.db
.fi

.LP
.nf
/etc/mail/aliases.dir
.fi

.LP
.nf
/etc/mail/aliases.pag
.fi

.LP
.nf
~/.forward
.fi

.SH DESCRIPTION
.LP
These files contain mail addresses or aliases, recognized by \fBsendmail\fR(8)
for the local host:
.sp
.ne 2
.na
\fB/etc/passwd\fR
.ad
.sp .6
.RS 4n
Mail addresses (usernames) of local users.
.RE

.sp
.ne 2
.na
\fB/etc/mail/aliases\fR
.ad
.sp .6
.RS 4n
Aliases for the local host, in \fBASCII\fR format. Root can edit this file to
add, update, or delete local mail aliases.
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/aliases.\fR{\fIdir\fR , \fIpag\fR}\fR
.ad
.sp .6
.RS 4n
The aliasing information from \fB/etc/mail/aliases\fR, in binary \fBndbm\fR(3C)
format for use by \fBsendmail\fR(8). The program \fBnewaliases\fR(8)
maintains these files.
.RE

.sp
.ne 2
.na
\fB/etc/mail/aliases.db\fR
.ad
.sp .6
.RS 4n
 The aliasing information from \fB/etc/mail/aliases\fR, in binary, Berkeley
DataBase format for use by \fBsendmail\fR(8). The program maintains these
files.
.sp
Depending on the configuration of the AliasFile option in
\fB/etc/mail/sendmail.cf\fR, either the single file \fBaliases.db\fR or the
pair of files \fBaliases.\fR{dir, pag} is generated by \fBnewaliases\fR(8). As
shipped with Solaris, \fBsendmail\fR(8) supports both formats. If neither is
specified, the Berkeley DataBase format which generates the single \fB\&.db\fR
file is used.
.RE

.sp
.ne 2
.na
\fB~/.forward\fR
.ad
.sp .6
.RS 4n
Addresses to which a user's mail is forwarded (see \fBAutomatic Forwarding\fR).
.RE

.sp
.LP
In addition, the \fBNIS\fR name services aliases map \fImail.aliases\fR
contains addresses and aliases
available for use across the network.
.SS "Addresses"
.LP
As distributed, \fBsendmail\fR(8) supports the following types of addresses:
.SS "Local Usernames"
.in +2
.nf
\fIusername\fR
.fi
.in -2

.sp
.LP
Each local \fIusername\fR is listed in the local host's \fB/etc/passwd\fR file.
.SS "Local Filenames"
.in +2
.nf
\fIpathname\fR
.fi
.in -2

.sp
.LP
Messages addressed to the absolute \fIpathname\fR of a file are appended to
that file.
.SS "Commands"
.in +2
.nf
\fB|\fR\fBcommand\fR
.fi
.in -2

.sp
.LP
If the first character of the address is a vertical bar (\fB\||\|\fR),
\fBsendmail\fR(8) pipes the message to the standard input of the \fBcommand\fR
the bar precedes.
.SS "Internet-standard Addresses"
.in +2
.nf
\fIusername\fR\fB@\fR\fIdomain\fR
.fi
.in -2

.sp
.LP
If \fIdomain\fR does not contain any `\fB\&.\fR' (dots), then it is interpreted
as the name of a host in the current domain. Otherwise, the message is passed
to a \fImailhost\fR that determines how to get to the specified domain. Domains
are divided into subdomains separated by dots, with the top-level domain on the
right.
.sp
.LP
For example, the full address of John Smith could be:
.sp
.in +2
.nf
\fBjs@jsmachine.Podunk-U.EDU\fR
.fi
.in -2

.sp
.LP
if he uses the machine named \fBjsmachine\fR at Podunk University.
.SS "\fBuucp\fR Addresses"
.in +2
.nf
\&.\|.\|. [\fIhost\fR\fB!\fR] \fIhost\fR\fB!\fR\fIusername\fR
.fi
.in -2

.sp
.LP
These are sometimes mistakenly referred to as ``Usenet'' addresses.
\fBuucp\fR(1C) provides links to numerous sites throughout the world for the
remote copying of files.
.sp
.LP
Other site-specific forms of addressing can be added by customizing the
\fBsendmail.cf\fR configuration file. See \fBsendmail\fR(8) for details.
Standard addresses are recommended.
.SS "Aliases"
.SS "Local Aliases"
.LP
\fB/etc/mail/aliases\fR is formatted as a series of lines of the form
.sp
.in +2
.nf
\fIaliasname\fR\fB:\fR\fIaddress\fR[, \fIaddress\fR]
.fi
.in -2

.sp
.LP
\fIaliasname\fR is the name of the alias or alias group, and \fIaddress\fR is
the address of a recipient in the group. Aliases can be nested. That is, an
\fIaddress\fR can be the name of another alias group. Because of the way
\fBsendmail\fR(8) performs mapping from upper-case to lower-case, an
\fIaddress\fR that is the name of another alias group must not contain any
upper-case letters.
.sp
.LP
Lines beginning with white space are treated as continuation lines for the
preceding alias. Lines beginning with \fB#\fR are comments.
.SS "Special Aliases"
.LP
An alias of the form:
.sp
.in +2
.nf
\fBowner-aliasname :\fR \fIaddress\fR
.fi
.in -2

.sp
.LP
\fBsendmail\fR directs error-messages resulting from mail to \fIaliasname\fR to
\fIaddress\fR, instead of back to the person who sent the message.
\fBsendmail\fR rewrites the \fBSMTP\fR envelope sender to match this, so
\fBowner-aliasname\fR should always point to \fBalias-request\fR, and
\fBalias-request\fR should point to the owner's actual address:
.sp
.in +2
.nf
owner-aliasname:      aliasname-request
aliasname-request     \fIaddress\fR
.fi
.in -2

.sp
.LP
An alias of the form:
.sp
.in +2
.nf
\fIaliasname\fR\fB: :include:\fR\fIpathname\fR
.fi
.in -2

.sp
.LP
with colons as shown, adds the recipients listed in the file \fIpathname\fR to
the \fIaliasname\fR alias. This allows a private list to be maintained
separately from the aliases file.
.SS "NIS Domain Aliases"
.LP
The aliases file on the master \fBNIS\fR server is used for the
\fImail.aliases\fR \fBNIS\fR map, which can be made available to every
\fBNIS\fR client. Thus, the \fB/etc/mail/aliases*\fR files on the various
hosts in a network will one day be obsolete. Domain-wide aliases should
ultimately be resolved into usernames on specific hosts. For example, if the
following were in the domain-wide alias file:
.sp
.in +2
.nf
jsmith:js@jsmachine
.fi
.in -2

.sp
.LP
then any \fBNIS\fR client could just mail to \fBjsmith\fR and not
have to remember the machine and username for John Smith.
.sp
.LP
If a \fBNIS\fR alias does not resolve to an address with a
specific host, then the name of the \fBNIS\fR domain is used.
There should be an alias of the domain name for a host in this case.
.sp
.LP
For example, the alias:
.sp
.in +2
.nf
jsmith:root
.fi
.in -2

.sp
.LP
sends mail on a \fBNIS\fR client to \fBroot@podunk-u\fR if the
name of the \fBNIS\fR domain is \fBpodunk-u\fR.
.SS "Automatic Forwarding"
.LP
When an alias (or address) is resolved to the name of a user on the local host,
\fBsendmail\fR(8) checks for a ~/.forward file, owned by the intended
recipient, in that user's home directory, and with universal read access. This
file can contain one or more addresses or aliases as described above, each of
which is sent a copy of the user's mail.
.sp
.LP
Care must be taken to avoid creating addressing loops in the \fB~/.forward\fR
file. When forwarding mail between machines, be sure that the destination
machine does not return the mail to the sender through the operation of any
\fBNIS\fR aliases. Otherwise, copies of the message may "bounce." Usually, the
solution is to change the \fBNIS\fR alias to direct mail to the proper
destination.
.sp
.LP
A backslash before a username inhibits further aliasing. For instance, to
invoke the \fBvacation\fR program, user \fBjs\fR creates a \fB~/.forward\fR
file that contains the line:
.sp
.in +2
.nf
\ejs, "|/usr/ucb/vacation js"
.fi
.in -2

.sp
.LP
so that one copy of the message is sent to the user, and another is piped into
the \fBvacation\fR program.
.sp
.LP
The \fB~/.forward\fR file can be used to specify special "per user" extensions
by creating a \fB\&.forward+extension\fR file in the home directory. For
example, with an address like \fBjsmith+jerry@jsmachine\fR, the
\fBsendmail\fR(8) utility recognizes everything before the "\fB+\fR" as the
actual username (\fBjsmith\fR) and everything after it, up to the "\fB@\fR"
symbol, as the extension (\fBjerry\fR) which is passed to the mail delivery
agent for local use.
.sp
.LP
The default value of the \fBForwardPath\fR processing option in
\fBsendmail\fR(8) is:
.sp
.in +2
.nf
O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z \e
/.forward
.fi
.in -2

.sp
.LP
where \fB$z\fR is the macro for the user's home directory, \fB$w\fR is the
macro for the local machine name and \fB$h\fR is the extension.  For example,
for mail using the address, \fBjsmith+jerry@jsmachine\fR, the
\fBsendmail\fR(8) utility checks each of the four following file names, in the
order given, to see if it exists and if it has "safe" permissions, that is,
that neither the file nor any of its parent directories are group- or
world-writable:
.sp
.in +2
.nf
~jsmith/.forward.jsmachine+jerry
~jsmith/.forward+jerry
~jsmith/.forward.jsmachine
~jsmith/.forward
.fi
.in -2

.sp
.LP
The first file that meets the conditions is used to forward the mail, that is,
all the entries in that file receive a copy of the mail. The search is then
stopped.
.SH FILES
.ne 2
.na
\fB\fB/etc/passwd\fR\fR
.ad
.RS 25n
Password file
.RE

.sp
.ne 2
.na
\fB\fB/etc/nsswitch.conf\fR\fR
.ad
.RS 25n
Name service switch configuration file
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/aliases\fR\fR
.ad
.RS 25n
Mail aliases file (ascii)
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/aliases.db\fR\fR
.ad
.RS 25n
Database of mail aliases (binary)
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/aliases.dir\fR\fR
.ad
.RS 25n
Database of mail aliases (binary)
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/aliases.pag\fR\fR
.ad
.RS 25n
Database of mail aliases (binary)
.RE

.sp
.ne 2
.na
\fB\fB/etc/mail/sendmail.cf\fR\fR
.ad
.RS 25n
sendmail configuration file
.RE

.sp
.ne 2
.na
\fB\fB~/.forward\fR\fR
.ad
.RS 25n
Forwarding information file
.RE

.SH SEE ALSO
.LP
.BR passwd (1),
.BR vacation (1),
.BR uucp (1C),
.BR getusershell (3C),
.BR ndbm (3C),
.BR passwd (5),
.BR shells (5),
.BR attributes (7),
.BR newaliases (8),
.BR sendmail (8)
.SH NOTES
.LP
Because of restrictions in \fBndbm\fR(3C), a single alias cannot contain more
than about \fB1000\fR characters (if this format is used). The Berkeley
DataBase format does not have any such restriction. Nested aliases can be used
to circumvent this limit.
.sp
.LP
For aliases which result in piping to a program or concatenating a file, the
shell of the controlling user must be allowed. Which shells are and are not
allowed are determined by \fBgetusershell\fR(3C).
